import {TOKEN_TIME,TOKEN_TIME_VALUE} from './constant' 
// 登录时设置时间
export const setTokenTime = () => {
  localStorage.setItem(TOKEN_TIME,Date.now())
}
//获取时间
export const getTokenTime = () => {
  return localStorage.getItem(TOKEN_TIME)
}
// 判断是否过期
export const diffTokenTime = () => {
  // 当前时间
  const currenTime = Date.now()
  // 用户登录时间
  const tokenTime = getTokenTime()
  return currenTime-tokenTime > TOKEN_TIME_VALUE
}